package com.wx.leetcode;

import java.util.Arrays;

/**
 * @description: 一维数组的动态和
 * @author: wx
 * @create: 2020-12-01 16:14
 **/
public class RunningSumTopic {

    public static int[] runningSum(int[] nums) {
        for (int i = 1; i < nums.length; i++) {
             nums[i] += nums[i-1];
        }
        return nums;
    }

    public static void main(String[] agrs){
        Arrays.stream(runningSum(new int[]{1, 1, 1, 1, 1})).forEach(System.out::println);
    }
}
